home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol E-12
/
(Vol E-12) May 21 2012.iso
/
Animations
/
dj
/
dj.swf
/
scripts
/
__Packages
/
mx
/
controls
/
streamingmedia
/
LoadBar.as
< prev
next >
Wrap
Text File
|
2012-05-21
|
3KB
|
146 lines
class mx.controls.streamingmedia.LoadBar extends MovieClip
{
function LoadBar()
{
super();
this.init();
}
function init()
{
this._controller = this._parent;
this.draw();
}
function isVertical()
{
return !this._controller.__get__horizontal();
}
function getCompletionPercentage()
{
var _loc2_ = undefined;
if(this.isVertical())
{
_loc2_ = this.yToPercent(this._fill._height);
}
else
{
_loc2_ = this.xToPercent(this._fill._width);
}
return _loc2_;
}
function setCompletionPercentage(aPercentage)
{
aPercentage = Math.floor(aPercentage);
if(aPercentage < 0)
{
aPercentage = 0;
}
else if(aPercentage > 100)
{
aPercentage = 100;
}
if(this.isVertical())
{
this._fill._height = this.percentToY(aPercentage);
this._fill._y = this.getActualHeight() - this._fill._height - 1;
}
else
{
this._fill._width = this.percentToX(aPercentage);
}
}
function draw(size)
{
var _loc3_ = this.getCompletionPercentage();
if(this.isVertical())
{
if(size == null)
{
size = this.getHeight();
}
this._y = 8;
this._border._height = size;
this._background._height = size - 2;
}
else
{
if(size == null)
{
size = this.getWidth();
}
this._x = 8;
this._border._width = size;
this._background._width = size - 2;
}
this.setCompletionPercentage(_loc3_);
}
function getWidth()
{
var _loc2_ = undefined;
if(this.isVertical())
{
_loc2_ = 3;
}
else
{
_loc2_ = this._controller.__get__width() - 16;
}
return _loc2_;
}
function getHeight()
{
var _loc2_ = undefined;
if(this.isVertical())
{
if(this._controller.__get__expanded())
{
_loc2_ = this.getOpenHeight();
}
else
{
_loc2_ = this.getClosedHeight();
}
}
else
{
_loc2_ = 3;
}
return _loc2_;
}
function getActualHeight()
{
return this._border._height;
}
function getActualWidth()
{
return this._border._width;
}
function getOpenHeight()
{
return this._controller.__get__height() - 90;
}
function getClosedHeight()
{
return this._controller.__get__height() - 16;
}
function xToPercent(x)
{
var _loc2_ = 100 * x / (this.getActualWidth() - 2);
return _loc2_;
}
function percentToX(percent)
{
var _loc2_ = (this.getWidth() - 2) * (percent / 100);
return _loc2_;
}
function yToPercent(y)
{
var _loc2_ = 100 * (y - 0) / (this.getActualHeight() - 2);
return _loc2_;
}
function percentToY(percent)
{
var _loc2_ = (this.getActualHeight() - 2) * (percent / 100);
return _loc2_;
}
}